/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Entidades;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author uriel
 */
@Entity
@Table(name = "SINIESTRO_COLISION")
@NamedQueries({
    @NamedQuery(name = "SiniestroColision.findAll", query = "SELECT s FROM SiniestroColision s")})
public class SiniestroColision implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "SINIESTRO_ID")
    private Long siniestroId;
    @Basic(optional = false)
    @Column(name = "NUMERO_REPORTE_VIAL")
    private String numeroReporteVial;
    @Basic(optional = false)
    @Column(name = "BANDERA_GRUA")
    private short banderaGrua;
    @JoinColumn(name = "SINIESTRO_ID", referencedColumnName = "SINIESTRO_ID", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Siniestro siniestro;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "siniestroId")
    private Collection<AutoInvolucrado> autoInvolucradoCollection;

    public SiniestroColision() {
    }

    public SiniestroColision(Long siniestroId) {
        this.siniestroId = siniestroId;
    }

    public SiniestroColision(Long siniestroId, String numeroReporteVial, short banderaGrua) {
        this.siniestroId = siniestroId;
        this.numeroReporteVial = numeroReporteVial;
        this.banderaGrua = banderaGrua;
    }

    public Long getSiniestroId() {
        return siniestroId;
    }

    public void setSiniestroId(Long siniestroId) {
        this.siniestroId = siniestroId;
    }

    public String getNumeroReporteVial() {
        return numeroReporteVial;
    }

    public void setNumeroReporteVial(String numeroReporteVial) {
        this.numeroReporteVial = numeroReporteVial;
    }

    public short getBanderaGrua() {
        return banderaGrua;
    }

    public void setBanderaGrua(short banderaGrua) {
        this.banderaGrua = banderaGrua;
    }

    public Siniestro getSiniestro() {
        return siniestro;
    }

    public void setSiniestro(Siniestro siniestro) {
        this.siniestro = siniestro;
    }

    public Collection<AutoInvolucrado> getAutoInvolucradoCollection() {
        return autoInvolucradoCollection;
    }

    public void setAutoInvolucradoCollection(Collection<AutoInvolucrado> autoInvolucradoCollection) {
        this.autoInvolucradoCollection = autoInvolucradoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (siniestroId != null ? siniestroId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SiniestroColision)) {
            return false;
        }
        SiniestroColision other = (SiniestroColision) object;
        if ((this.siniestroId == null && other.siniestroId != null) || (this.siniestroId != null && !this.siniestroId.equals(other.siniestroId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.SiniestroColision[ siniestroId=" + siniestroId + " ]";
    }
    
}
